﻿using System;
using System.Drawing;
using System.Linq;

namespace Split
{
    class Program
    {
        static void Main(string[] args)
        {
            //int[] intArr0 = new int[3];

            int[] intArr1 =
            {
                10,
                9,
                8,
            };
            int[] intArr2 = new int[3]
            {
                10,
                9,
                8
            };
            //二维
            string[,] arr = { { "1", "1" }, { "1", "2" }, { "1", "3" } };
            for (int i = 0; i < arr.GetLength(0); i++)//GetLength(维度)能获取多维数组
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write(arr[i, j] + " ");
                }
            }
            Console.WriteLine();
            
            arr.ArrayInfo();


            //锯齿形
            //int[][] a = new int[3][];
            //a[0] = new int[] { 1, 2 };
            //a[1] = new int[] { 3, 4, 5 };
            //a[2] = new int[] { 6, 7, 8, 9 };
            //for (int n = 0; n < a.Length; n++)
            //{
            //    Console.WriteLine("输出数组中第" + (n + 1)+"行是");
            //    for (int m = 0; m < a[n].Length; n++)
            //    {
            //        Console.Write(a[n][m] + " ");
            //    }
            //    Console.WriteLine();





                //foreach
                int[] intArr ={
                        101,
                        201,
                        301
                };
                foreach(int into in intArr)
                {
                    Console.WriteLine(into);
                }


                int[] point = { 1, 2, 3, 4, 5, 6 };
                int sum = 0;
                foreach(int po in point)
                {
                    sum = sum + po;
                }
                Console.WriteLine(sum);


                string str = "闪闪发光的 , 宝贝";
                var strArr=str.Split('闪');
                string[] result = str.Split(strArr, StringSplitOptions.RemoveEmptyEntries);
                Console.WriteLine("闪有"+(result.Length+1)+"个");

                
            }
        }

    }

